package 斐波那契数列问题;

import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        System.out.println(waysToStep(n));
    }

    public static int waysToStep(int n) {
        // 可以从比当前阶层低一层/低两层/低三层的地方上楼 所以就是
        // T[i] = T[i-1] + T[i-2] + T[i-3]
        int mod = (int)1e9+7;
        if(n<=2)
            return n;
        int[] dp = new int[n+1];
        dp[0] = dp[1] = 1;
        dp[2] = 2;
        for (int i = 3; i <= n; i++) {
            dp[i] = ((dp[i-1]+dp[i-2])%mod+dp[i-3])%mod;
        }
        return dp[n];
    }
}
